////////////////////////////////////////////////////////////////
// This is a sample configuration file for use with
// the Hashjava application.
//
// [ This configuration file is used to obfuscate an
// installer utility, which requires some finicky handling of
// class and field names. ]
////////////////////////////////////////////////////////////////
//////////////////General directives////////////////////////////
// Verbose is equivalent to the -verbose option. It prints out reams
// of information about what it is doing.
// Verbose();
// SourceName(true) retains any source file names in the bytecode, false
// removes it.
// Not specifying this directive at all replaces the source
// name to a string which reads "Decompiling this code may be a
// violation of the licensing agreement"
SourceName(false);
// LineDebug(true) retains any line number information in the bytecode,
// false removes it.
// Not specifying this directive at all inserts confusing information
// in place of any existing line number tables. This will stop naive
// debuggers that attempt to step through your code.
LineDebug(false);
// LocalsDebug(true) retains any information about local variable <->
// symbol name mapping, false removes it.
// Not specifying this directive at all inserts confusing debuggin
// information (this causes Mocha to fail for instance)
// LocalsDebug(false);
// VerifierScript generates a simple list of commands which runs
// the JDK verifier on all the generated classes.
// If you have the Sun JDK, I STRONGLY recommend you create and run
// this file to check the correctness of the generated files
VerifierScript("d:\\temp\\checkit.bat");
//////////////Generating or reading a map of old and new names/////////
// the DumpMap directive dumps out a complete map of every method
// field and class that was renamed.
DumpMap("d:\\temp\\sym.map");
// The LoadMap directive is used to specify a specific mapping for
// method, field and class names. The format is identical to the file
// generated by DumpMap.
// If a particular symbol is not found in this file, a random name is
// generated. The name is guaranteed to be different from any name already
// used in the LoadMap file.
// LoadMap("d:\\temp\\sym.map");
/////////////Reading and writing files///////////////////////////////////
// ObfuscateRoot is used to add the root of a directory
// full of classes that need to be obfuscated. Alternatively,
// this can be an uncompressed zip file. You can use multiple
// ObfuscateRoot directives too.
ObfuscateRoot("c:\\Users\\kbs\\jinstall");
// ObfuscateRoot("d:\\temp\\ff.zip");
// OutputDir is the directory where the obfuscated classes will
// be written.
//>>>>>>WARNING: FILES IN THIS DIRECTORY WILL BE OVERWRITTEN.<<<<<<<<<
OutputDir("d:\\temp\\kk");
//////////////Excluding specific items from obfuscation////////////////
// ExcludeAll is a directive which ignores all classes matching
// a "specification".
//
// A specification takes two arguments, a type specification and
// a name pattern.
//
// The first argument is a type specification. ALL matches everything.
// You can specify instead any constant like PUBLIC or STATIC or PRIVATE
// which mean their usual things. The list of all valid constants are:
// NONE,PUBLIC,PRIVATE,PROTECTED,STATIC,FINAL
// SYNCHRONIZED,VOLATILE,TRANSIENT,NATIVE,INTERFACE,ABSTRACT,ALL
// Note that NONE actually matches the "default" permissions (like
// if you write a class or method or field with no additional qualifiers.)
// You can also "&" these constants to build up expressions like
// PUBLIC & STATIC
//
// The second argument is a pattern (you can use wild cards * and ?)
// used to match a class or method name.
// ExcludeAll(ALL, "sbktech.*");
// ExcludeClass is a directive which avoids renaming just a class name
// matching this specification. Methods and fields in this class
// will still be renamed if possible.
ExcludeClass(ALL, "sbktech.tools.jinstall.runtime.*");
ExcludeClass(ALL, "sbktech.tools.jinstall.panels.*");
ExcludeClass(ALL, "sbktech.tools.jinstall.actions.*");
ExcludeClass(ALL, "install");
ExcludeClass(ALL, "sbktech.tools.jinstall.Main");
// ExcludeMethod is a directive which stops renaming any method
// matching this specification.
ExcludeMethod(PUBLIC & STATIC, "sbktech.tools.jinstall.Main.main");
ExcludeMethod(PUBLIC & STATIC, "install.main");
// ExcludeField is a directive which stops renaming any field
// matching this specification.
ExcludeField(PUBLIC&FINAL&STATIC, "install.decompressorOffset");
ExcludeField(PUBLIC&FINAL&STATIC, "install.decompressorLength");
ExcludeField(PUBLIC&FINAL&STATIC, "install.installCodeOffset");
ExcludeField(PUBLIC&FINAL&STATIC, "install.infoDataOffset");
ExcludeField(PUBLIC&FINAL&STATIC, "install.actionDataOffset");
ExcludeField(PUBLIC&FINAL&STATIC, "install.archiveDataOffset");
/////////////////////Renaming packages//////////////////////////
// By default, the batch obfuscator will not rename the package
// names, only the class names within a package. This directive
// lets you rename a package.
// Note:
// 1. RenamePackage("sbktech.tools", "X");
// will rename any class like
// sbktech.tools.MyClass -> X.MyClass
// however, this mapping remains as it is
// sbktech.tools.foo.MyClass -> sbktech.tools.foo.MyClass
// (this assumes that the class name MyClass is not obfuscated,
// otherwise MyClass will also be changed as usual)
//
// 2. RenamePackage() overrides ExcludeAll or ExcludeClass()
// for the package part of the name. For example,
//
// RenamePackage("sbktech", "X");
// ExcludeAll("sbktech.*");
//
// will still rename a class sbktech.MyClass to X.MyClass
RenamePackage("sbktech.tools.jinstall", "_");
// This allows you to switch the name generation strategy.
// The batch obfuscator picks new names with a class that
// returns a sequence of unique names. This directive
// allows you to either swap in your own name generator, or
// choose a different generator from what is available. (Look at
// sbktech.tools.hashjava.util.NameGenerator for the interface to
// the name generator)
// In v0.6, there are three name generators.
// sbktech.tools.hashjava.util.FileNameGenerator
// picks names that will work as file names in most
// file systems (uses only lowercase alphabets a-z in its names)
// sbktech.tools.hashjava.util.UnicodeGenerator
// picks names that consist of java unicode characters
// sbktech.tools.hashjava.util.NumberGenerator
// picks names like _<number>
//
// The default configuration uses this setup for the name generators
// which generates the most compact classes. You can uncomment any
// of the following three directives with different NameGenerators
// if you want to alter the names used.
// ClassNameGenerator("sbktech.tools.hashjava.util.FileNameGenerator");
// MethodNameGenerator("sbktech.tools.hashjava.util.UnicodeGenerator");
// FieldNameGenerator("sbktech.tools.hashjava.util.UnicodeGenerator");
// DontDump is used to prevent dumping out classes. By default,
// hashjava will write out all classes that are in its environment,
// whether or not they have been obfuscated. A default filter of
// DontDump(ALL, "java.*") is always used.